package com.gzz.orchid.context.application.rbac.command;

import com.gzz.orchid.common.core.tuple.Option;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.util.Locale;
import java.util.Set;

/**
 * @author higmd
 */
@Data
public class RoleSaveCmd {
    private Long id;
    /**
     * 角色编码（唯一）
     */
    @NotBlank
    @Size(min = 4)
    private String code;
    /**
     * 角色名称
     */
    @NotBlank
    private String name;
    /**
     * 描述
     */
    private String description;
    /**
     * 角色权限
     */
    @NotNull(message = "{required.parameter}")
    @Size(min = 1, message = "{required.least.n.item}")
    private Set<Option<String[]>> authorizes;

    public String getCode() {
        return code.toUpperCase(Locale.ENGLISH);
    }
}
